﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataLayer
{
    public partial class EncounterRepository
    {
        /// <summary>
        /// Return a list of Encounter objects
        /// </summary>
        /// <returns>A List of type <see cref="Encounter"/></returns>
        public List<BusinessObjects.Encounter> GetEncountersForPatient(int PatientID)
        {
            List<BusinessObjects.Encounter> retObject = new List<BusinessObjects.Encounter>();

            using (dB = new PracticeSimpleDataContext())
            {
                var EncounterList = (from x in dB.Encounters where x.PatientID ==  PatientID select x).ToList();

                foreach (Encounter obj in EncounterList)
                {
                    retObject.Add(ConvertToBusinessObject(obj));
                }

            }
            return retObject;
        }
    }
}
